import Vue from 'vue'
import Vuex from 'vuex'

Vue.use(Vuex)

export default new Vuex.Store({
  state: {
    activePath:'/home',
    authList: [],
    total:0
  },
  getters:{
   getActicePath(state){
     return state.activePath
   }
  },
  mutations: {
    // 定义
    useActivePath(state,activePath){
      state.activePath=activePath
    },
    useAuthList(state,authList){
      state.authList = authList
    },
    setTotal(state,total){
      state.total = total
    }
    // 使用
    // _this.$store.commit("useActivePath", path);
  },
  actions: {
    // 定义
    useActivePath(context,activePath){
      context.commit('useActivePath',activePath)
    },
    useAuthList(context,authList){
      context.commit('useAuthList',authList)
    },
    setTotal(context,total){
      context.commit('setTotal',total)
    },
    // 使用
    // _this.$store.dispatch("useActivePath",path)
  },
  modules: {
  }
})
